package cn.tedu.elo.pet_breeds.controller;

import cn.tedu.elo.base.response.JsonResult;
import cn.tedu.elo.pet_breeds.pojo.dto.Pet_breedsQuery;
import cn.tedu.elo.pet_breeds.pojo.dto.Pet_breedsSaveParam;
import cn.tedu.elo.pet_breeds.pojo.vo.Pet_breedsVO;
import cn.tedu.elo.pet_breeds.service.Pet_breedsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/v1/pet_breeds")
public class Pet_breedsController {
    @Autowired
    Pet_breedsService pet_breedsService;

    @GetMapping("select")
    public JsonResult selectPet_breeds(Pet_breedsQuery pet_breedsQuery){
        log.debug("查询宠物:Pet_breedsQuery={}", pet_breedsQuery);
        List<Pet_breedsVO> list = pet_breedsService.selectPet_breeds(pet_breedsQuery);
        return JsonResult.ok(list);
    }
    @PostMapping("save")
    public JsonResult savePet(Pet_breedsSaveParam pet_breedsSaveParam){
        log.debug("保存宠物:pet_breedsSaveParam={}", pet_breedsSaveParam);
        pet_breedsService.savePet(pet_breedsSaveParam);
        return JsonResult.ok();
    }
    @PostMapping("delete/{id}")
    public JsonResult deletePet_breeds(@PathVariable Long id){
        log.debug("删除宠物品种:id={}", id);
        pet_breedsService.deletePet_breeds(id);
        return JsonResult.ok();
    }
}
